package com.gitee.cirnochat.user.model.vo.resp;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.gitee.cirnochat.user.model.entity.FriendApplyInfo;
import com.gitee.cirnochat.user.model.enums.FriendAddType;
import com.gitee.cirnochat.user.model.enums.FriendRequestStatus;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.time.LocalDateTime;

@Data
@Schema(name = "好友请求展示对象")
public class FriendApplyVo {

    @Schema(description = "好友请求ID")
    private Long id;

    @Schema(description = "请求发起方ID")
    private Long fromId;

    @Schema(description = "请求接收方方ID")
    private Long toId;

    @Schema(description = "请求发起方昵称")
    private String nickname;

    @Schema(description = "请求发起方头像")
    private String avatar;

    @Schema(description = "验证信息")
    private String message;

    @Schema(description = "推荐人ID")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Long invitorId;

    @Schema(description = "推荐人昵称")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private String invitorNickname;

    @Schema(description = "请求状态（pending/accepted/rejected）")
    private FriendRequestStatus status;

    @Schema(description = "请求类型")
    private FriendAddType type;

    @Schema(description = "请求时间")
    private LocalDateTime createTime;

    public FriendApplyVo(FriendApplyInfo friendApplyInfo) {
        BeanUtils.copyProperties(friendApplyInfo, this);
    }
}